package io.renren.common.utils;

import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;

public class PasswordUtil {
    /**
     * md5加密算法
     *
     * @param password
     * @param salt
     * @return
     */
    public static String getMD5Password(String password, String salt) {
        //增加加密系数
        for (int i = 0; i < 3; i++) {
            password = DigestUtils.md5DigestAsHex((salt + password + salt).getBytes(StandardCharsets.UTF_8)).toUpperCase();
        }
        return password;
    }
}
